<div class="wrap">
<h2>Manage Scope</h2>
<table class="widefat">
	<thead>
	<tr>
		<th scope="col"><div style="text-align: center;">Date</div></th>
		<th scope="col">ID</th>
		<th scope="col">Title</th>
		<th scope="col">Submitter's Name</th>
		<th scope="col">Submitter's Email</th>
		<th scope="col">Link</th>
		<th scope="col" colspan="3">Action </th>
	</tr>
	</thead>
	<tbody id="the-list">
<?php
if($_REQUEST['action'] == 'delete') {
	$wpdb->get_results("DELETE FROM {$wpdb->prefix}scope WHERE ID='$_REQUEST[scope]'");
}
$all_problems = $wpdb->get_results("SELECT ID, title, name, email, url, date_created FROM {$wpdb->prefix}scope ORDER BY ID");
if (count($all_problems)) {
	$class = 'alternate';	
	foreach($all_problems as $scope) {
		$class = ('alternate' == $class) ? '' : 'alternate';
		print "<tr id='scope-{$scope->ID}' class='$class'>\n";
		?>
		<td><?php echo date(get_option('date_format') . ' ' . get_option('time_format'), strtotime($scope->date_created)) ?></td>
		<th scope="row" style="text-align: center;"><?php echo $scope->ID ?></th>
		<th scope="row" style="text-align: center;"><?php echo $scope->title ?></th>
		<td><?php echo $scope->name ?></td>
		<td><?php echo $scope->email ?></td>
		<td><?php echo $scope->url ?></td>
		<td><a href='edit.php?page=scope/view_problem.php&amp;scope=<?php echo $scope->ID?>' class='edit'><?php echo 'View/Edit';?></a></td>
		
		<td><a href='edit.php?page=scope/manage_scope.php&amp;action=delete&amp;scope=<?php echo $scope->ID?>' class='delete' onclick="return confirm('<?php echo "You are about to delete this problem. Proceed?"?>');"><?php echo 'Delete'?></a></td>
		</tr>
<?php
	}
	} else {
?>
		<tr>
			<td colspan="4"><?php echo 'Nothing Found!'; ?></td>
		</tr>
<?php
}
?>
	</tbody>
</table>